<template>
    <div class="subpage cart">
        <my-head title="我的购物车"></my-head>
        <van-swipe-cell class="cell" v-for="(l,i) in cartList" :key="i">
            <van-card
                :num="l.count"
                :price="l.good.price"
                :desc="l.good.type.text"
                :title="l.good.name"
                class="goods-card"
                :thumb="l.good.img"
            />
            <template #right>
                <van-button square text="删除" type="danger" class="delete-button" />
            </template>
        </van-swipe-cell>
    </div>
</template>

<script>
export default {
    data(){
        return {
            cartList:[]
        }
    },
    methods:{
        async findcart(){
            let res = await this.$ajax.findcart({
                username:this.userInfo.username
            })
            this.cartList = res;
        }
    },
    mounted(){
        this.findcart()
    }
}
</script>

<style lang="scss" scoped>
.cart{
    width:100%;
    padding:15px;
}
.cell{
    margin-top:10px;
}
</style>